package com.leetcode.algorithm.y22.m07;

import java.util.HashSet;
import java.util.Set;

/**
 * 217. 存在重复元素
 * 
 * https://leetcode.cn/problems/contains-duplicate/
 * 
 * @author jie.deng
 *
 */
public class Question0217Solution01 {

	public boolean containsDuplicate(int[] nums) {
		Set<Integer> set = new HashSet<Integer>();
		for (int i = 0; i < nums.length; i++) {
			if (!set.add(nums[i])) {
				return true;
			}
		}
		return false;
	}

}
